package com.hehanpeng.springbootnetty.model;

import com.hehanpeng.springbootnetty.java8583.core.Iso8583CibMessage;
import com.hehanpeng.springbootnetty.java8583.field.Iso8583Field;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author hehanpeng
 * 2018/5/9 17:59
 */
@Data
public class CibInputPaygateData {
    private String a_3;

    public CibInputPaygateData() {
    }

    public CibInputPaygateData(Iso8583CibMessage iso8583CibMessage) {
        Map<Integer, Iso8583Field> tmpMap = iso8583CibMessage.getAllValues();
        Map<String, Object> map = new HashMap<String, Object>();
        for (Map.Entry<Integer, Iso8583Field> entry : tmpMap.entrySet()) {
            map.put(entry.getValue().getAlias().toLowerCase(), entry.getValue().getValue());
        }
        this.setA_3((String) map.get("a_3"));
    }

}